<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="vtc" uri="/vtc-core-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/common/meta.jsp"%>
<title>VTC - Holistic category - HPP</title>
<%@ include file="/common/css_js.jsp"%>

<script type="text/javascript">
	$(function(){
		iframeResize(self,"phraseOutIframe","phraseOutContainer");
	});
	
	function selectAllProgrammes(){
		var cb=$("#allProgrammes");
		if(cb.attr("checked")==true){
			var cbRoleCodes=document.getElementsByName("selectProgrammeList")
			for(i=0;i<cbRoleCodes.length;i++){
				cbRoleCodes[i].checked=true;
			}
		}else{
			var cbRoleCodes=document.getElementsByName("selectProgrammeList")
			for(i=0;i<cbRoleCodes.length;i++){
				cbRoleCodes[i].checked=false;
			}
		}
	}
	
	function deleteProg(){
		var hasAttribute = false;
		var cbRoleCodes=document.getElementsByName("selectProgrammeList")
		for(i=0;i<cbRoleCodes.length;i++){
			if(cbRoleCodes[i].checked==true){
				hasAttribute = true;
				break;
			}
		}
		if(!hasAttribute){
			if(confirm("Please select one Programme Attribute at least.")){
				return false;
			}
		}else{
			$("#outForm").attr('action', 'selectedPhraseOut!delete.action?no-decorate=0');
			$("#outForm").submit();
		}
	}
</script>

<body>

<div class="bodyBlank">
  <div class="padding" > <!-- InstanceBeginEditable name="content" -->
    <div class="bodyBlank2" >

		<div class="sListBorder">
		      	      	<label class="noteBlue"> Phase-out Programme means those programme have Planned Place figure in past planning exercise, but without "Actual Enrolment" figure in previous year, and without "Planned Place" figure in consecutive "Duration Year (the duration of Programme) + 1" years.

</label>
	      <div class="sList">

        <s:form name="outForm" id="outForm" method="post">
        
        <s:hidden name="categoryNodeId" id="categoryNodeId"
						value="%{categoryNodeId}"></s:hidden>
					<s:hidden name="categoryNodeType" id="categoryNodeType"
						value="%{categoryNodeType}" />
					<s:hidden name="treeType" id="treeType" value="%{treeType}"/>
					<s:hidden id="categoryId" name="categoryId"
					value="%{categoryId}"></s:hidden>
	        <table  id="phraseOutContainer" cellspacing="0" cellpadding="0" border="0" width="100%" class="sTable">
	          <tbody>
	          <tr>
	            <td colspan="5" class="sTh">Select Programme by Programme Code</td>
	          </tr>
	          <tr>
	            <td class="sTh checkbox">
	            <input class="inputCheckbox"
								type="checkbox" id="allProgrammes" name="allProgrammes"
								onclick="selectAllProgrammes()" />
				</td>
	            <td class="sTh">Programme Code </td>
	            <td class="sTh">Programme Title </td>
	            <td class="sTh">Funding Mode </td>
	            <td class="sTh">Operating Campus</td>
	          </tr>
	          
			 <s:if test="%{selectedPhraseOuts!=null&&selectedPhraseOuts.size()!=0}">
		       <s:iterator value="selectedPhraseOuts" var="selectedPhraseOut" status="st">
		       
		          <tr class="sRow2">
		            <td class="sCell">
						<s:checkbox name="selectProgrammeList"
										value="0" fieldValue="%{#selectedPhraseOut.id}"></s:checkbox>						            
					</td>
		            <td class="sCell"><s:property value='#selectedPhraseOut.programme.code' /></td>
		            <td class="sCell"><s:property value='#selectedPhraseOut.programme.titleShort' /></td>
		            <td class="sCell">Market Fee </td>
		            <td class="sCell">TC</td>
		          </tr>				  
				  
				</s:iterator>
			  </s:if>  
          
	        </tbody>
	        </table>
	        </s:form>
	      </div>
	      
	      <div class="btnSet btnSetTypeA">
	        <div class="left">
	          <div class="button">
	            <div class="left">
	             <div class="right">
	<input class="inputButton" type="button" id="" name=""
		value="Add"
		onclick="parent.popup(event, 'selectedPhraseOut!turnToPhaseOutProgrammePage.action?no-decorate=0&categoryNodeId=<s:property value='categoryNodeId'/>&categoryNodeType=<s:property value='categoryNodeType'/>&categoryId=<s:property value='categoryId'/>&treeType=<s:property value='treeType'/>', 'width:600;height:300'); " />
			</div>
	            </div>
	          </div>
	          <div class="button">
	            <div class="left">
	              <div class="right">
						<input class="inputButton" type="button" id="" name=""
							value="Delete" onclick="deleteProg()" />
					</div>
	            </div>
	          </div>
	        </div>
	      </div>
		</div>	

      
    </div>
  </div>
</div>
</body>

      <script>
function checkLevel1Endorsed(){
	var type = parent.document.getElementById("categoryNodeType").value;
	var categoryId = parent.document.getElementById("categoryId").value;
	$.ajax({
		url : "category!checkLevel1Endorsed.action?no-decorate=0&categoryId="+categoryId,
		cache : true,
		dataType : "text",
		async : false,
		success : function(data) {
			if(data=="true"){
				if(type="Root"){
					$("input[type='button']").attr("disabled", "true");
				}
			}
		},
		error : function(data) {
		}
	});
}
checkLevel1Endorsed();
</script>